/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2018/11/24 Time: 21:19
 *
 * 功能建议
 */

//导入"react"文件里export的一个默认组件，将其命名为React以及Component这个非默认组件
import React, {Component} from 'react';
//导入组件
import {
    View,//视图组件
    Text,//文本组件
    TextInput,//文本输入组件
    TouchableOpacity,//鼠标按下组件
    SafeAreaView
} from 'react-native';
import {connect} from 'react-redux';
import {COLOR_GRAY_BACKGROUND, COLOR_GRAY_LINE, COLOR_THEME, COLOR_WHITE} from "../../constant/PHColors";

class FunctionalSuggestionsScreen extends Component {

    static navigationOptions = {
        title: '功能建议'
    }

    // 构造
    constructor(props) {
        super(props);
        // 初始状态-
        this.state = {
            ceshi: '我是全局变量'
        };
    }

    render() {
        return (
            <SafeAreaView style={{backgroundColor:COLOR_GRAY_BACKGROUND,flex: 1}}>
                <View style={{backgroundColor: COLOR_WHITE,borderBottomColor: COLOR_GRAY_LINE,borderTopColor:COLOR_GRAY_LINE,borderBottomWidth: 1,borderTopWidth:1,marginTop: 20}}>
                    <Text style={{fontSize:14,marginTop:5,marginLeft: 15}}>內容</Text>
                    <TextInput multiline={true} underlineColorAndroid={'transparent'} placeholder={'您可以在此提出问题，提交bug或提议新功能'}
                        style={{height: 140, borderWidth: 0, textAlignVertical: 'top',padding: 0,fontSize:12,borderTopColor:COLOR_GRAY_LINE,borderTopWidth: 1,marginTop:10,marginLeft: 15,marginRight: 15}}
                    />
                </View>
                <View style={{backgroundColor:'white',marginTop: 20}}>
                    <Text style={{fontSize:14,marginTop:5,marginLeft: 15}}>联系方式</Text>
                    <TextInput underlineColorAndroid={'transparent'} placeholder={'您的电话和手机'}
                               style={{height: 30, borderWidth: 0, textAlignVertical: 'top',padding: 0,fontSize:12,borderTopColor:COLOR_GRAY_LINE,borderTopWidth: 1,marginTop:10,marginLeft: 15,marginRight: 15}}
                    />
                </View>
                <View style={{marginTop: 20}}>
                    <TouchableOpacity onPress={this._onClickSubmit.bind(this)}  activeOpacity={0.7} style={{alignItems: 'center',backgroundColor:COLOR_THEME ,padding: 10,borderRadius: 4,marginLeft: 15,marginRight: 15}}>
                        <Text style={{color:'white',fontSize:12}}>提交</Text>
                    </TouchableOpacity>
                </View>
                <View style={{marginTop :10}}>
                    <View style={{alignItems: 'center',backgroundColor: '#DDDDDD',padding: 10,borderRadius: 4,marginLeft: 15,marginRight: 15}}>
                        <Text style={{color:COLOR_THEME,fontSize:12}}>客服电话:0411-12345678 {this.state.ceshi}</Text>
                    </View>
                </View>

            </SafeAreaView>
        )
    }
    /**
     * 点击提交
     * @private
     */
    _onClickSubmit(){
        alert('点击事件,'+this.state.ceshi);
    }
}


const props = state => {
    return {
        ceshi:'我是默认值'
    }
}


export default FunctionalSuggestionsScreen = connect(props)(FunctionalSuggestionsScreen)


